﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using Gizmox.WebGUI.Forms;

namespace FreeOnlineApplication
{
    public class UserControlFactory
    {
        Hashtable m_userControlCollection = new Hashtable();
        public const string USER = "User";
        public const string COMPANY_PROFILE = "Unit";
        public const string ROOM_TYPE = "RoomType";
        public const string ROOM_MASTER = "RoomMaster";
        public const string FOOD = "Food";
        public const string LAUNDRY = "Laundry";
        public const string CUSTOMER = "Customer";
        public const string BOOKING = "Booking";
        public const string SUPPLIER = "Supplier";
        public const string FACILITY = "Facility";
        public const string CHECKIN = "CheckIn";
        public const string CHECKAVAILABLEROOM = "CheckAvailableRoom";
        public const string FACILITYTRANSACTION = "FacilityTransaction";


        public const string DEPARTMENT = "Department";
        public const string DESIGNATION = "Designation";
        public const string WORKRULE = "WorkRule";
        public const string EMPLOYEE = "Employee";

        public UserControlFactory()
        {
        }
        public UserControl GetUserControl(string key, IMainForm m)
        {
            UserControl uc = (UserControl)m_userControlCollection[key];
            if (uc == null)
            {
                switch (key)
                {
                    case USER:
                        m_userControlCollection.Add(key, new UserUserControl(USER, m));
                        break;
                    case COMPANY_PROFILE:
                        m_userControlCollection.Add(key, new UnitUserControl(COMPANY_PROFILE, m));
                        break;
                    case ROOM_TYPE:
                        m_userControlCollection.Add(key, new RoomTypeUserControl(ROOM_TYPE, m));
                        break;
                    case ROOM_MASTER:
                        m_userControlCollection.Add(key, new RoomMasterUserControl(ROOM_MASTER, m));
                        break;
                    case FOOD:
                        m_userControlCollection.Add(key, new FoodUserControl(FOOD, m));
                        break;
                    case LAUNDRY:
                        m_userControlCollection.Add(key, new LaundryUserControl(LAUNDRY, m));
                        break;
                    case CUSTOMER:
                        m_userControlCollection.Add(key, new CustomerUserControl(CUSTOMER, m));
                        break;
                    case BOOKING:
                        m_userControlCollection.Add(key, new BookingUserControl(BOOKING, m));
                        break;
                    case SUPPLIER:
                        m_userControlCollection.Add(key, new SupplierUserControl(SUPPLIER, m));
                        break;
                    case FACILITY:
                        m_userControlCollection.Add(key, new FacilityUserControl(FACILITY, m));
                        break;
                    case CHECKIN:
                        m_userControlCollection.Add(key, new CheckInUserControl(CHECKIN, m));
                        break;
                    case CHECKAVAILABLEROOM:
                        m_userControlCollection.Add(key, new CheckRoomUserControl(CHECKAVAILABLEROOM, m));
                        break;
                    case FACILITYTRANSACTION:
                        m_userControlCollection.Add(key, new FacilityTransactionUserControl(FACILITYTRANSACTION, m));
                        break;
                    //    case WORKRULE:
                    //        m_userControlCollection.Add(key, new WorkRuleUserControl());
                    //        break;
                    //    case EMPLOYEE:
                    //        m_userControlCollection.Add(key, new EmployeeUserControl());
                    //        break;
                }
            }
            uc = (UserControl)m_userControlCollection[key];
            return uc;
        }
    }
}
